package com.bobo.medicinechest.adapter;

import android.widget.ImageView;

import androidx.annotation.Nullable;

import com.bobo.medicinechest.R;
import com.bobo.medicinechest.bean.GoodsBean;
import com.bobo.medicinechest.bean.GoodsTypeBean;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;


public class GoodsListAdapter extends BaseQuickAdapter<GoodsBean, BaseViewHolder> {

    public GoodsListAdapter(@Nullable List<GoodsBean> data) {
        super(R.layout.item_goods_list, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, GoodsBean item) {
        //药品分类，暂时不做
//        ImageView ivTag = helper.getView(R.id.ivTag);
//        if (helper.getLayoutPosition() == 0) {
//            ivTag.setBackgroundResource(R.mipmap.ic_spash);
//        } else {
//            ivTag.setBackgroundResource(R.mipmap.ic_launcher);
//        }

        helper.setText(R.id.tvName, item.getName());
        helper.setText(R.id.tvNum, "剩余："+ item.getNumber());
        helper.setText(R.id.tvPrice, "￥" + item.getPrice());

        helper.addOnClickListener(R.id.iv);
        helper.addOnClickListener(R.id.ivAdd);
    }

}